Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

90
Views
Escriba una función de clase "AntraMath" y Constructor junto con las funciones de definición "agregar", "multiplicar" y "hecho" para que el valor de "res" impreso sea 30

Fragmento de código:

 let myMath = new AntraMath(10); myMath.add(5); myMath.multiply(2); let res = myMath.done(); console.log(res);

Intento de función constructora:

 function AntraMath (_value){ let myMath = new AntraMath(10); myMath.add(5); myMath.multiply(2); let res = myMath.done(); console.log(res); }

Traté de crear una función de Constructor "AntraMath" y seguir los errores que se dan después. Pero después de configurar; Recibí "Salida: [Listo] salió con el código = 0" en lugar de recibir cualquier error o la salida deseada 30.

Gracias a quien alguna vez pueda estar leyendo esto junto con cualquier aporte dado.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Deberá definir una clase (o prototipo) y utilizarla. Su código contiene uso, pero no contiene las definiciones que necesita.

 class AntraMath { constructor(_value) { this._value = _value; } add(_value) { this._value += _value; return this; } multiply(_value) { this._value *= _value; return this; } done() { return this._value; } } let myMath = new AntraMath(10); myMath.add(5); myMath.multiply(2); let res = myMath.done(); console.log(res);

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!